package client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import parm.PageParam;
import parm.ProductIdParam;
import parm.ProductIdsParam;
import parm.ProductSaveParam;
import pojo.Product;
import utils.R;

import java.util.List;

@FeignClient("product-service")
public interface ProductClient {

    @PostMapping("/product/collect/list")
    R collectList(@RequestBody ProductIdsParam productIdsParam);

    @PostMapping("/product/cart/detail")
    Product cartDetail(@RequestBody ProductIdParam productIdParam);

    @PostMapping("/product/cart/list")
    List<Product> cartList(@RequestBody ProductIdsParam productIdsParam);


    @GetMapping("/product/list")
    R getProducts(@RequestBody PageParam pageParam);

    @PostMapping("/product/update")
    R update(@RequestBody  Product product);

    @PostMapping("/product/save")
    R adminSave(@RequestBody ProductSaveParam productSaveParam);

    @PostMapping("/product/remove")
    R remove(@RequestBody Integer productId);

}
